分级时,默认打开指定下级的路由,使用redirect属性,其值为子级路由的路径path.
子级使用属性children: 值为数组,数组中每个元素都是一个路由对象
二级路由
在main.js中配置路由
// 二级路由
import Contact from './components/about/Contact'
import Delivery from './components/about/Delivery'
import History from './components/about/History'
import OrderingGuide from './components/about/OrderingGuide'
在routes中,(routes是由每一个路由对象组成的数组)
{
path: '/about',
name: 'aboutLink',
component: About,
redirect: '/about/contact',
children: [{
path: '/about/contact',
name: "contactLink",
component: Contact,
redirect: '/personname',
children: [{
path: '/phone',
name: "phoneNumber",
component: Phone
},
{
path: '/personname'